<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @author &lt;a href="http://www.creynders.be">Camille Reynders&lt;/a>
<span class='line'>  3</span>  */</span><span class="WHIT">
<span class='line'>  4</span> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  5</span> 
<span class='line'>  6</span> </span><span class="WHIT">    </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  7</span> 
<span class='line'>  8</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>  9</span>      * @namespace
<span class='line'> 10</span>      */</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">dijon</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 13</span>          * framework version number
<span class='line'> 14</span>          * @constant
<span class='line'> 15</span>          * @type String
<span class='line'> 16</span>          */</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">        </span><span class="NAME">VERSION</span><span class="PUNC">:</span><span class="STRN">'0.5.3'</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="COMM">//dijon</span><span class="WHIT">
<span class='line'> 19</span> 
<span class='line'> 20</span> 
<span class='line'> 21</span> </span><span class="WHIT">    </span><span class="COMM">//======================================//</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">    </span><span class="COMM">// dijon.System</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">    </span><span class="COMM">//======================================//</span><span class="WHIT">
<span class='line'> 24</span> 
<span class='line'> 25</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 26</span>      * @class dijon.System
<span class='line'> 27</span>      * @constructor
<span class='line'> 28</span>      */</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">    </span><span class="NAME">dijon.System</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">        </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">        </span><span class="NAME">this._mappings</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 32</span> 
<span class='line'> 33</span> </span><span class="WHIT">        </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">        </span><span class="NAME">this._outlets</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 35</span> 
<span class='line'> 36</span> </span><span class="WHIT">        </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">        </span><span class="NAME">this._handlers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span> 
<span class='line'> 39</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 40</span>          * When &lt;code>true&lt;/code> injections are made only if an object has a property with the mapped outlet name.&lt;br/>
<span class='line'> 41</span>          * &lt;strong>Set to &lt;code>false&lt;/code> at own risk&lt;/strong>, may have quite undesired side effects.
<span class='line'> 42</span>          * @example
<span class='line'> 43</span>          * system.strictInjections = true
<span class='line'> 44</span>          * var o = {};
<span class='line'> 45</span>          * system.mapSingleton( 'userModel', UserModel );
<span class='line'> 46</span>          * system.mapOutlet( 'userModel' );
<span class='line'> 47</span>          * system.injectInto( o );
<span class='line'> 48</span>          *
<span class='line'> 49</span>          * //o is unchanged
<span class='line'> 50</span>          *
<span class='line'> 51</span>          * system.strictInjections = false;
<span class='line'> 52</span>          * system.injectInto( o );
<span class='line'> 53</span>          *
<span class='line'> 54</span>          * //o now has a member 'userModel' which holds a reference to the singleton instance
<span class='line'> 55</span>          * //of UserModel
<span class='line'> 56</span>          * @type Boolean
<span class='line'> 57</span>          * @default true
<span class='line'> 58</span>          */</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">        </span><span class="NAME">this.strictInjections</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> 
<span class='line'> 61</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 62</span>          * Enables the automatic mapping of outlets for mapped values, singletons and classes
<span class='line'> 63</span>          * When this is true any value, singleton or class that is mapped will automatically be mapped as a global outlet
<span class='line'> 64</span>          * using the value of &lt;code>key&lt;/code> as outlet name
<span class='line'> 65</span>          *
<span class='line'> 66</span>          * @example
<span class='line'> 67</span>          * var o = {
<span class='line'> 68</span>          *     userModel : undefined; //inject
<span class='line'> 69</span>          * }
<span class='line'> 70</span>          * system.mapSingleton( 'userModel', UserModel );
<span class='line'> 71</span>          * system.injectInto( o ):
<span class='line'> 72</span>          * //o.userModel now holds a reference to the singleton instance of UserModel
<span class='line'> 73</span>          * @type Boolean
<span class='line'> 74</span>          * @default false
<span class='line'> 75</span>          */</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">        </span><span class="NAME">this.autoMapOutlets</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> 
<span class='line'> 78</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 79</span>          * The name of the method that will be called for all instances, right after injection has occured.
<span class='line'> 80</span>          * @type String
<span class='line'> 81</span>          * @default 'setup'
<span class='line'> 82</span>          */</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">        </span><span class="NAME">this.postInjectionHook</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'setup'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> 
<span class='line'> 85</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="COMM">//dijon.System</span><span class="WHIT">
<span class='line'> 86</span> 
<span class='line'> 87</span> </span><span class="WHIT">    </span><span class="NAME">dijon.System.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 88</span> 
<span class='line'> 89</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 90</span>          * @private
<span class='line'> 91</span>          * @param {Class} clazz
<span class='line'> 92</span>          */</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">        </span><span class="NAME">_createAndSetupInstance</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Clazz</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Clazz</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">            </span><span class="NAME">this.injectInto</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 98</span> 
<span class='line'> 99</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>100</span>          * @private
<span class='line'>101</span>          * @param {String} key
<span class='line'>102</span>          * @param {Boolean} overrideRules
<span class='line'>103</span>          * @return {Object}
<span class='line'>104</span>          */</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">        </span><span class="NAME">_retrieveFromCacheOrCreate</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">overrideRules</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">overrideRules</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">                </span><span class="NAME">overrideRules</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">output</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this._mappings.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">config</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._mappings</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">overrideRules</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">config.isSingleton</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">config.object</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">                        </span><span class="NAME">config.object</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._createAndSetupInstance</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config.clazz</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">                    </span><span class="NAME">output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.object</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">config.clazz</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT">                        </span><span class="NAME">output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._createAndSetupInstance</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config.clazz</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">                        </span><span class="COMM">//TODO shouldn't this be null</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">                        </span><span class="NAME">output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.object</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">output</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>130</span> 
<span class='line'>131</span> 
<span class='line'>132</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>133</span>          * defines &lt;code>outletName&lt;/code> as an injection point in &lt;code>targetKey&lt;/code>for the object mapped to &lt;code>sourceKey&lt;/code>
<span class='line'>134</span>          * @example
<span class='line'>135</span>          system.mapSingleton( 'userModel', TestClassA );
<span class='line'>136</span>          var o = {
<span class='line'>137</span>          user : undefined //inject
<span class='line'>138</span>          }
<span class='line'>139</span>          system.mapOutlet( 'userModel', 'o', 'user' );
<span class='line'>140</span>          system.mapValue( 'o', o );
<span class='line'>141</span> 
<span class='line'>142</span>          var obj = system.getObject( 'o' );
<span class='line'>143</span>          * //obj.user holds a reference to the singleton instance of UserModel
<span class='line'>144</span>          *
<span class='line'>145</span>          * @example
<span class='line'>146</span>          system.mapSingleton( 'userModel', TestClassA );
<span class='line'>147</span>          var o = {
<span class='line'>148</span>          userModel : undefined //inject
<span class='line'>149</span>          }
<span class='line'>150</span>          system.mapOutlet( 'userModel', 'o' );
<span class='line'>151</span>          system.mapValue( 'o', o );
<span class='line'>152</span> 
<span class='line'>153</span>          var obj = system.getObject( 'o' );
<span class='line'>154</span>          * //obj.userModel holds a reference to the singleton instance of UserModel
<span class='line'>155</span>          *
<span class='line'>156</span>          * @example
<span class='line'>157</span>          system.mapSingleton( 'userModel', TestClassA );
<span class='line'>158</span>          system.mapOutlet( 'userModel' );
<span class='line'>159</span>          var o = {
<span class='line'>160</span>          userModel : undefined //inject
<span class='line'>161</span>          }
<span class='line'>162</span>          system.mapValue( 'o', o );
<span class='line'>163</span> 
<span class='line'>164</span>          var obj = system.getObject( 'o' );
<span class='line'>165</span>          * //o.userModel holds a reference to the singleton instance of userModel
<span class='line'>166</span>          *
<span class='line'>167</span>          * @param {String} sourceKey the key mapped to the object that will be injected
<span class='line'>168</span>          * @param {String} [targetKey='global'] the key the outlet is assigned to.
<span class='line'>169</span>          * @param {String} [outletName=sourceKey] the name of the property used as an outlet.&lt;br/>
<span class='line'>170</span>          * @return {dijon.System}
<span class='line'>171</span>          * @see dijon.System#unmapOutlet
<span class='line'>172</span>          */</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">        </span><span class="NAME">mapOutlet</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">sourceKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">targetKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">outletName</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>174</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sourceKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1010</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT">            </span><span class="NAME">targetKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">targetKey</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"global"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT">            </span><span class="NAME">outletName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">outletName</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">sourceKey</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>179</span> 
<span class='line'>180</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">this._outlets.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">targetKey</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">                </span><span class="NAME">this._outlets</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">targetKey</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT">            </span><span class="NAME">this._outlets</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">targetKey</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">outletName</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sourceKey</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> 
<span class='line'>185</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>187</span> 
<span class='line'>188</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>189</span>          * Retrieve (or create) the object mapped to &lt;code>key&lt;/code>
<span class='line'>190</span>          * @example
<span class='line'>191</span>          * system.mapValue( 'foo', 'bar' );
<span class='line'>192</span>          * var b = system.getObject( 'foo' ); //now contains 'bar'
<span class='line'>193</span>          * @param {Object} key
<span class='line'>194</span>          * @return {Object}
<span class='line'>195</span>          */</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">        </span><span class="NAME">getObject</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1020</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._retrieveFromCacheOrCreate</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>202</span> 
<span class='line'>203</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>204</span>          * Maps &lt;code>useValue&lt;/code> to &lt;code>key&lt;/code>
<span class='line'>205</span>          * @example
<span class='line'>206</span>          * system.mapValue( 'foo', 'bar' );
<span class='line'>207</span>          * var b = system.getObject( 'foo' ); //now contains 'bar'
<span class='line'>208</span>          * @param {String} key
<span class='line'>209</span>          * @param {Object} useValue
<span class='line'>210</span>          * @return {dijon.System}
<span class='line'>211</span>          */</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">        </span><span class="NAME">mapValue</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">useValue</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1030</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">            </span><span class="NAME">this._mappings</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">                </span><span class="NAME">clazz</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">                </span><span class="NAME">object</span><span class="PUNC">:</span><span class="NAME">useValue</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">                </span><span class="NAME">isSingleton</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.autoMapOutlets</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">                </span><span class="NAME">this.mapOutlet</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.hasMapping</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">                </span><span class="NAME">this.injectInto</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">useValue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>229</span> 
<span class='line'>230</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>231</span>          * Returns whether the key is mapped to an object
<span class='line'>232</span>          * @example
<span class='line'>233</span>          * system.mapValue( 'foo', 'bar' );
<span class='line'>234</span>          * var isMapped = system.hasMapping( 'foo' );
<span class='line'>235</span>          * @param {String} key
<span class='line'>236</span>          * @return {Boolean}
<span class='line'>237</span>          */</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">        </span><span class="NAME">hasMapping</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1040</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._mappings.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>244</span> 
<span class='line'>245</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>246</span>          * Maps &lt;code>clazz&lt;/code> as a factory to &lt;code>key&lt;/code>
<span class='line'>247</span>          * @example
<span class='line'>248</span>          * var SomeClass = function(){
<span class='line'>249</span>          * }
<span class='line'>250</span>          * system.mapClass( 'o', SomeClass );
<span class='line'>251</span>          *
<span class='line'>252</span>          * var s1 = system.getObject( 'o' );
<span class='line'>253</span>          * var s2 = system.getObject( 'o' );
<span class='line'>254</span>          *
<span class='line'>255</span>          * //s1 and s2 reference two different instances of SomeClass
<span class='line'>256</span>          *
<span class='line'>257</span>          * @param {String} key
<span class='line'>258</span>          * @param {Function} clazz
<span class='line'>259</span>          * @return {dijon.System}
<span class='line'>260</span>          */</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">        </span><span class="NAME">mapClass</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">clazz</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1050</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">clazz</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1051</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT">            </span><span class="NAME">this._mappings</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT">                </span><span class="NAME">clazz</span><span class="PUNC">:</span><span class="NAME">clazz</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">                </span><span class="NAME">object</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">                </span><span class="NAME">isSingleton</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>273</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.autoMapOutlets</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>274</span> </span><span class="WHIT">                </span><span class="NAME">this.mapOutlet</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>276</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>277</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>278</span> 
<span class='line'>279</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>280</span>          * Maps &lt;code>clazz&lt;/code> as a singleton factory to &lt;code>key&lt;/code>
<span class='line'>281</span>          * @example
<span class='line'>282</span>          * var SomeClass = function(){
<span class='line'>283</span>          * }
<span class='line'>284</span>          * system.mapSingleton( 'o', SomeClass );
<span class='line'>285</span>          *
<span class='line'>286</span>          * var s1 = system.getObject( 'o' );
<span class='line'>287</span>          * var s2 = system.getObject( 'o' );
<span class='line'>288</span>          *
<span class='line'>289</span>          * //s1 and s2 reference the same instance of SomeClass
<span class='line'>290</span>          *
<span class='line'>291</span>          * @param {String} key
<span class='line'>292</span>          * @param {Function} clazz
<span class='line'>293</span>          * @return {dijon.System}
<span class='line'>294</span>          */</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">        </span><span class="NAME">mapSingleton</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">clazz</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1060</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">clazz</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1061</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">            </span><span class="NAME">this._mappings</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">                </span><span class="NAME">clazz</span><span class="PUNC">:</span><span class="NAME">clazz</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT">                </span><span class="NAME">object</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT">                </span><span class="NAME">isSingleton</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.autoMapOutlets</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">                </span><span class="NAME">this.mapOutlet</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>312</span> 
<span class='line'>313</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>314</span>          * Force instantiation of the class mapped to &lt;code>key&lt;/code>, whether it was mapped as a singleton or not.
<span class='line'>315</span>          * When a value was mapped, the value will be returned.
<span class='line'>316</span>          * TODO: should this last rule be changed?
<span class='line'>317</span>          * @example
<span class='line'>318</span>          var SomeClass = function(){
<span class='line'>319</span>          }
<span class='line'>320</span>          system.mapClass( 'o', SomeClass );
<span class='line'>321</span> 
<span class='line'>322</span>          var s1 = system.getObject( 'o' );
<span class='line'>323</span>          var s2 = system.getObject( 'o' );
<span class='line'>324</span>          * //s1 and s2 reference different instances of SomeClass
<span class='line'>325</span>          *
<span class='line'>326</span>          * @param {String} key
<span class='line'>327</span>          * @return {Object}
<span class='line'>328</span>          */</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">        </span><span class="NAME">instantiate</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1070</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._retrieveFromCacheOrCreate</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>335</span> 
<span class='line'>336</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>337</span>          * Perform an injection into an object's mapped outlets, satisfying all it's dependencies
<span class='line'>338</span>          * @example
<span class='line'>339</span>          * var UserModel = function(){
<span class='line'>340</span>          * }
<span class='line'>341</span>          * system.mapSingleton( 'userModel', UserModel );
<span class='line'>342</span>          * var SomeClass = function(){
<span class='line'>343</span>          *      user = undefined; //inject
<span class='line'>344</span>          * }
<span class='line'>345</span>          * system.mapSingleton( 'o', SomeClass );
<span class='line'>346</span>          * system.mapOutlet( 'userModel', 'o', 'user' );
<span class='line'>347</span>          *
<span class='line'>348</span>          * var foo = {
<span class='line'>349</span>          *      user : undefined //inject
<span class='line'>350</span>          * }
<span class='line'>351</span>          *
<span class='line'>352</span>          * system.injectInto( foo, 'o' );
<span class='line'>353</span>          *
<span class='line'>354</span>          * //foo.user now holds a reference to the singleton instance of UserModel
<span class='line'>355</span>          * @param {Object} instance
<span class='line'>356</span>          * @param {String} [key] use the outlet mappings as defined for &lt;code>key&lt;/code>, otherwise only the globally
<span class='line'>357</span>          * mapped outlets will be used.
<span class='line'>358</span>          * @return {dijon.System}
<span class='line'>359</span>          */</span><span class="WHIT">
<span class='line'>360</span> </span><span class="WHIT">        </span><span class="NAME">injectInto</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>361</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>362</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1080</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>363</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT">				</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this._outlets.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">'global'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>367</span> </span><span class="WHIT">					</span><span class="NAME">o.push</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this._outlets</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="STRN">'global'</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>369</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._outlets.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>370</span> </span><span class="WHIT">					</span><span class="NAME">o.push</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this._outlets</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>372</span> </span><span class="WHIT">				</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>373</span> </span><span class="WHIT">					</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>374</span> </span><span class="WHIT">					</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT">						</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">						</span><span class="COMM">//must be "in" [!]</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">						</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">this.strictInjections</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT">							</span><span class="NAME">instance</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getObject</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">						</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT">					</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>381</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>382</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"setup"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>383</span> </span><span class="WHIT">					</span><span class="NAME">instance.setup.call</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>384</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>385</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>386</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>388</span> 
<span class='line'>389</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>390</span>          * Remove the mapping of &lt;code>key&lt;/code> from the system
<span class='line'>391</span>          * @param {String} key
<span class='line'>392</span>          * @return {dijon.System}
<span class='line'>393</span>          */</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">        </span><span class="NAME">unmap</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>396</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1090</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>397</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>398</span> </span><span class="WHIT">            </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">this._mappings</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>399</span> 
<span class='line'>400</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>401</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>402</span> 
<span class='line'>403</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>404</span>          * removes an injection point mapping for a given object mapped to &lt;code>key&lt;/code>
<span class='line'>405</span>          * @param {String} target
<span class='line'>406</span>          * @param {String} outlet
<span class='line'>407</span>          * @return {dijon.System}
<span class='line'>408</span>          * @see dijon.System#addOutlet
<span class='line'>409</span>          */</span><span class="WHIT">
<span class='line'>410</span> </span><span class="WHIT">        </span><span class="NAME">unmapOutlet</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>411</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1100</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1101</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">            </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">this._outlets</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">outlet</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>418</span> 
<span class='line'>419</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>421</span> 
<span class='line'>422</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>423</span>          * maps a handler for an event/route.&lt;br/>
<span class='line'>424</span>          * @example
<span class='line'>425</span>          var hasExecuted = false;
<span class='line'>426</span>          var userView = {
<span class='line'>427</span>          showUserProfile : function(){
<span class='line'>428</span>          hasExecuted = true;
<span class='line'>429</span>          }
<span class='line'>430</span>          }
<span class='line'>431</span>          system.mapValue( 'userView', userView );
<span class='line'>432</span>          system.mapHandler( 'user/profile', 'userView', 'showUserProfile' );
<span class='line'>433</span>          system.notify( 'user/profile' );
<span class='line'>434</span>          //hasExecuted is true
<span class='line'>435</span>          * @example
<span class='line'>436</span>          * var userView = {
<span class='line'>437</span>          *      showUserProfile : function(){
<span class='line'>438</span>          *          //do stuff
<span class='line'>439</span>          *      }
<span class='line'>440</span>          * }
<span class='line'>441</span>          * system.mapValue( 'userView', userView );
<span class='line'>442</span>          * &lt;strong>system.mapHandler( 'showUserProfile', 'userView' );&lt;/strong>
<span class='line'>443</span>          * system.notify( 'showUserProfile' );
<span class='line'>444</span>          *
<span class='line'>445</span>          * //userView.showUserProfile is called
<span class='line'>446</span>          * @example
<span class='line'>447</span>          * var showUserProfile = function(){
<span class='line'>448</span>          *          //do stuff
<span class='line'>449</span>          * }
<span class='line'>450</span>          * &lt;strong>system.mapHandler( 'user/profile', undefined, showUserProfile );&lt;/strong>
<span class='line'>451</span>          * system.notify( 'user/profile' );
<span class='line'>452</span>          *
<span class='line'>453</span>          * //showUserProfile is called
<span class='line'>454</span>          * @example
<span class='line'>455</span>          * var userView = {};
<span class='line'>456</span>          * var showUserProfile = function(){
<span class='line'>457</span>          *          //do stuff
<span class='line'>458</span>          * }
<span class='line'>459</span>          * system.mapValue( 'userView', userView );
<span class='line'>460</span>          * &lt;strong>system.mapHandler( 'user/profile', 'userView', showUserProfile );&lt;/strong>
<span class='line'>461</span>          * system.notify( 'user/profile' );
<span class='line'>462</span>          *
<span class='line'>463</span>          * //showUserProfile is called within the scope of the userView object
<span class='line'>464</span>          * @example
<span class='line'>465</span>          * var userView = {
<span class='line'>466</span>          *      showUserProfile : function(){
<span class='line'>467</span>          *          //do stuff
<span class='line'>468</span>          *      }
<span class='line'>469</span>          * }
<span class='line'>470</span>          * system.mapValue( 'userView', userView );
<span class='line'>471</span>          * &lt;strong>system.mapHandler( 'user/profile', 'userView', 'showUserProfile', true );&lt;/strong>
<span class='line'>472</span>          * system.notify( 'user/profile' );
<span class='line'>473</span>          * system.notify( 'user/profile' );
<span class='line'>474</span>          * system.notify( 'user/profile' );
<span class='line'>475</span>          *
<span class='line'>476</span>          * //userView.showUserProfile is called exactly once [!]
<span class='line'>477</span>          * @example
<span class='line'>478</span>          * var userView = {
<span class='line'>479</span>          *      showUserProfile : function( route ){
<span class='line'>480</span>          *          //do stuff
<span class='line'>481</span>          *      }
<span class='line'>482</span>          * }
<span class='line'>483</span>          * system.mapValue( 'userView', userView );
<span class='line'>484</span>          * &lt;strong>system.mapHandler( 'user/profile', 'userView', 'showUserProfile', false, true );&lt;/strong>
<span class='line'>485</span>          * system.notify( 'user/profile' );
<span class='line'>486</span>          *
<span class='line'>487</span>          * //userView.showUserProfile is called and the route/eventName is passed to the handler
<span class='line'>488</span>          * @param {String} eventName/route
<span class='line'>489</span>          * @param {String} [key=undefined] If &lt;code>key&lt;/code> is &lt;code>undefined&lt;/code> the handler will be called without
<span class='line'>490</span>          * scope.
<span class='line'>491</span>          * @param {String|Function} [handler=eventName] If &lt;code>handler&lt;/code> is &lt;code>undefined&lt;/code> the value of
<span class='line'>492</span>          * &lt;code>eventName&lt;/code> will be used as the name of the member holding the reference to the to-be-called function.
<span class='line'>493</span>          * &lt;code>handler&lt;/code> accepts either a string, which will be used as the name of the member holding the reference
<span class='line'>494</span>          * to the to-be-called function, or a direct function reference.
<span class='line'>495</span>          * @param {Boolean} [oneShot=false] Defines whether the handler should be called exactly once and then automatically
<span class='line'>496</span>          * unmapped
<span class='line'>497</span>          * @param {Boolean} [passEvent=false] Defines whether the event object should be passed to the handler or not.
<span class='line'>498</span>          * @return {dijon.System}
<span class='line'>499</span>          * @see dijon.System#notify
<span class='line'>500</span>          * @see dijon.System#unmapHandler
<span class='line'>501</span>          */</span><span class="WHIT">
<span class='line'>502</span> </span><span class="WHIT">        </span><span class="NAME">mapHandler</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oneShot</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">passEvent</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>503</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1110</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>505</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>506</span> </span><span class="WHIT">            </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'global'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>507</span> </span><span class="WHIT">            </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>508</span> 
<span class='line'>509</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">oneShot</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>510</span> </span><span class="WHIT">                </span><span class="NAME">oneShot</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>511</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>512</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">passEvent</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">                </span><span class="NAME">passEvent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">this._handlers.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">                </span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="NAME">eventName</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">                </span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="NAME">eventName</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>521</span> </span><span class="WHIT">            </span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>522</span> </span><span class="WHIT">                </span><span class="NAME">handler</span><span class="PUNC">:</span><span class="NAME">handler</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>523</span> </span><span class="WHIT">                </span><span class="NAME">oneShot</span><span class="PUNC">:</span><span class="NAME">oneShot</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">                </span><span class="NAME">passEvent</span><span class="PUNC">:</span><span class="NAME">passEvent</span><span class="WHIT">
<span class='line'>525</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>526</span> 
<span class='line'>527</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>528</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>529</span> 
<span class='line'>530</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>531</span>          * Unmaps the handler for a specific event/route.
<span class='line'>532</span>          * @param {String} eventName Name of the event/route
<span class='line'>533</span>          * @param {String} [key=undefined] If &lt;code>key&lt;/code> is &lt;code>undefined&lt;/code> the handler is removed from the
<span class='line'>534</span>          * global mapping space. (If the same event is mapped globally and specifically for an object, then
<span class='line'>535</span>          * only the globally mapped one will be removed)
<span class='line'>536</span>          * @param {String | Function} [handler=eventName]
<span class='line'>537</span>          * @return {dijon.System}
<span class='line'>538</span>          * @see dijon.System#mapHandler
<span class='line'>539</span>          */</span><span class="WHIT">
<span class='line'>540</span> </span><span class="WHIT">        </span><span class="NAME">unmapHandler</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>542</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1120</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>543</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">            </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'global'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>545</span> </span><span class="WHIT">            </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>546</span> 
<span class='line'>547</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this._handlers.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">handlers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">                </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">handlers</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>550</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">config</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">config.handler</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">                        </span><span class="NAME">handlers.splice</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>553</span> </span><span class="WHIT">                        </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>557</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>558</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>559</span> 
<span class='line'>560</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>561</span>          * calls all handlers mapped to &lt;code>eventName/route&lt;/code>
<span class='line'>562</span>          * @param {String} eventName/route
<span class='line'>563</span>          * @return {dijon.System}
<span class='line'>564</span>          * @see dijon.System#mapHandler
<span class='line'>565</span>          */</span><span class="WHIT">
<span class='line'>566</span> </span><span class="WHIT">        </span><span class="NAME">notify</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>567</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>568</span> </span><span class="WHIT">                </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1130</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>569</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>570</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">argsWithEvent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>571</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">argsClean</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">argsWithEvent.slice</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>572</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this._handlers.hasOwnProperty</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>573</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">handlers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">eventName</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>574</span> </span><span class="WHIT">                </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">handlers</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>575</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">configs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>576</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>577</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'global'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>578</span> </span><span class="WHIT">                        </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getObject</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>579</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>580</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">toBeDeleted</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>581</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>582</span> </span><span class="WHIT">                    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">configs.length</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>583</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>584</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">config</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">configs</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>585</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">config.handler</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>586</span> </span><span class="WHIT">                            </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">config.handler</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>587</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>588</span> </span><span class="WHIT">                            </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.handler</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>589</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>590</span> 
<span class='line'>591</span> </span><span class="WHIT">                        </span><span class="COMM">//see deletion below</span><span class="WHIT">
<span class='line'>592</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">config.oneShot</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>593</span> </span><span class="WHIT">                            </span><span class="NAME">toBeDeleted.unshift</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>594</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>595</span> 
<span class='line'>596</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">config.passEvent</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>597</span> </span><span class="WHIT">                            </span><span class="NAME">handler.apply</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">argsWithEvent</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>598</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>599</span> </span><span class="WHIT">                            </span><span class="NAME">handler.apply</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">argsClean</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>600</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>601</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>602</span> 
<span class='line'>603</span> </span><span class="WHIT">                    </span><span class="COMM">//items should be deleted in reverse order</span><span class="WHIT">
<span class='line'>604</span> </span><span class="WHIT">                    </span><span class="COMM">//either use push above and decrement here</span><span class="WHIT">
<span class='line'>605</span> </span><span class="WHIT">                    </span><span class="COMM">//or use unshift above and increment here</span><span class="WHIT">
<span class='line'>606</span> </span><span class="WHIT">                    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">toBeDeleted.length</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>607</span> </span><span class="WHIT">                        </span><span class="NAME">configs.splice</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">toBeDeleted</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>608</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>609</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>610</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>611</span> 
<span class='line'>612</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>613</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>614</span> 
<span class='line'>615</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="COMM">//dijon.System.prototype</span><span class="WHIT">
<span class='line'>616</span> 
<span class='line'>617</span> </span><span class="WHIT">    </span><span class="NAME">scope.dijon</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dijon</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>618</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>619</span> 
<span class='line'>620</span> 
<span class='line'>621</span> </span></pre></body></html>